# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
source ~/.zsh/powerlevel10k/powerlevel10k.zsh-theme
source ~/.zsh/powerlevel10k/powerlevel10k.zsh-theme
export EDITOR="nvim"
export PATH=~/.npm-global/bin:$PATH


# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

bindkey -v

function zle-keymap-select {
	if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then
		echo -ne '\e[1 q'
	elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || [[ $1 = 'beam' ]]; then
		echo -ne '\e[5 q'
  fi
}
zle -N zle-keymap-select

# Use beam shape cursor on startup.
echo -ne '\e[5 q'

# Use beam shape cursor for each new prompt.
preexec() {
	echo -ne '\e[5 q'
}

_fix_cursor() {
	echo -ne '\e[5 q'
}
precmd_functions+=(_fix_cursor)

KEYTIMEOUT=1

# Define aliases.
alias config="cd ~/.config"
alias ca="conda activate"
alias tree='tree -a -I .git'
alias ll="exa -l --color=auto"
alias zshconfig="nvim ~/.zshrc"
alias sz="exec zsh"
alias v="nvim"
alias cl="clear"
alias lg="lazygit"
alias nf="clear & neofetch"
alias cg="cd ~/Git"
#alias ra="ranger"
alias DL="conda activate PyTorchDL"
alias py="python3"
alias pyins="pip3 install"
alias pyuins="pip3 uninstall"
alias fq="export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890"
alias dell="ssh_tmux Dell Dell"
alias dl="ssh_tmux Dell_Local Dell"
alias mid="ssh_tmux VATIS-MID WTH"
alias a1="ssh_tmux A100 WTH"

ssh_tmux(){
	ssh $1 -t "tmux -u attach -t $2 || tmux new -s $2"
}

ra() {
    if [ -z "$RANGER_LEVEL" ]
    then
        ranger
    else
        exit
    fi
}

source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.config/zsh/conda.sh

# Fig post block. Keep at the bottom of this file.
[[ -f "$HOME/.fig/shell/zshrc.post.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.post.zsh"
